﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


    public partial class MasterPage2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        private string m_Titulo;
        public string Titulo
        {
            get
            {
                return m_Titulo;
            }
            set
            {
                m_Titulo = value;
            }
       }
        protected void ConsultarFactura()
        {
            IList infofacturas = null;
            FacturaControl fc = new FacturaControl();
            infofacturas = fc.BuscarFacturasFecha(this.Date4.Text);
            int totalrow = infofacturas.Count;
            if (totalrow == 0)
            {
                this.GridView1.Columns.Clear();
                this.GridView1.EmptyDataText = "No existen Facturas Emitidas para Esta Fecha" + this.Date4.Text;
                this.GridView1.DataSource = infofacturas;
                this.GridView1.DataBind();
                this.Button2.Enabled = false;
                
            }
            else
            {
                this.GridView1.Caption = "Reporte de Facturas Emitidas el " + this.Date4.Text;
                this.Button2.Enabled = true;
                GridView1.DataSource = infofacturas;
                GridView1.DataBind();
            }
        }
        
        protected void CambioPagina(object sender, GridViewPageEventArgs e)
        {

            GridView1.PageIndex = e.NewPageIndex;
            this.ConsultarFactura();

        }
        protected void ValidarFormato(object sender, EventArgs e)
        {
            ConsultarFactura();
        }
        protected void ExportarFacEmitidas(object sender, EventArgs e)
        {
            ExportarReporte exporto = new ExportarReporte();
            exporto.ExportarCsv(this.GridView1, "FacturasCobradas" + this.Date4.Text, this.Page);
        }



 }



